# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-ITSM 蓝鲸流程服务 available.

Copyright (C) 2021 THL A29 Limited, a Tencent company.  All rights reserved.

BK-ITSM 蓝鲸流程服务 is licensed under the MIT License.

License for BK-ITSM 蓝鲸流程服务:
--------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

# Generated by Django 1.11.24 on 2019-09-19 20:00
import jsonfield.fields
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('ticket', '0026_auto_20190429_1618'),
    ]

    operations = [
        migrations.CreateModel(
            name='Status',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creator', models.CharField(blank=True, max_length=64, null=True, verbose_name='\u521b\u5efa\u4eba')),
                ('create_at', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
                (
                    'updated_by',
                    models.CharField(blank=True, max_length=64, null=True, verbose_name='\u4fee\u6539\u4eba'),
                ),
                ('end_at', models.DateTimeField(blank=True, null=True, verbose_name='\u7ed3\u675f\u65f6\u95f4')),
                (
                    'is_deleted',
                    models.BooleanField(db_index=True, default=False, verbose_name='\u662f\u5426\u8f6f\u5220\u9664'),
                ),
                ('ticket_id', models.IntegerField(verbose_name='\u5355\u636eID')),
                ('state_id', models.IntegerField(verbose_name='\u8282\u70b9ID')),
                ('bk_biz_id', models.IntegerField(blank=True, default=-1, null=True, verbose_name='\u4e1a\u52a1ID')),
                ('name', models.CharField(default='', max_length=64, verbose_name='\u8282\u70b9\u540d')),
                (
                    'status',
                    models.CharField(
                        choices=[
                            ('WAIT', '\u5f85\u5904\u7406'),
                            ('RUNNING', '\u5904\u7406\u4e2d'),
                            ('RECEIVING', '\u5f85\u8ba4\u9886'),
                            ('DISTRIBUTING', '\u5f85\u5206\u6d3e'),
                            ('TERMINATED', '\u88ab\u7ec8\u6b62'),
                            ('FINISHED', '\u5df2\u7ed3\u675f'),
                            ('FAILED', '\u6267\u884c\u5931\u8d25'),
                            ('SUSPEND', '\u88ab\u6302\u8d77'),
                        ],
                        default='WAIT',
                        max_length=32,
                        verbose_name='\u8282\u70b9\u72b6\u6001',
                    ),
                ),
                (
                    'action_type',
                    models.CharField(
                        choices=[
                            ('TRANSITION', '\u63d0\u4ea4'),
                            ('DISTRIBUTE', '\u5206\u6d3e'),
                            ('CLAIM', '\u8ba4\u9886'),
                            ('AUTOMATIC', '\u81ea\u52a8\u6267\u884c'),
                        ],
                        default='PROCESS',
                        max_length=32,
                        verbose_name='\u8282\u70b9\u5185\u90e8\u64cd\u4f5c\u7c7b\u578b',
                    ),
                ),
                (
                    'distribute_type',
                    models.CharField(
                        choices=[
                            ('DISTRIBUTE_THEN_PROCESS', '\u5148\u6d3e\u5355\uff0c\u540e\u5904\u7406'),
                            ('PROCESS', '\u76f4\u63a5\u5904\u7406'),
                            ('CLAIM_THEN_PROCESS', '\u5148\u8ba4\u9886\uff0c\u540e\u5904\u7406'),
                            ('DISTRIBUTE_THEN_CLAIM', '\u5148\u6d3e\u5355\uff0c\u540e\u8ba4\u9886'),
                        ],
                        default='PROCESS',
                        max_length=32,
                        verbose_name='\u5206\u914d\u65b9\u5f0f',
                    ),
                ),
                (
                    'processors_type',
                    models.CharField(
                        choices=[
                            ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                            ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                            ('OPEN', '\u4e0d\u9650'),
                            ('PERSON', '\u4e2a\u4eba'),
                            ('STARTER', '\u63d0\u5355\u4eba'),
                            ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                            ('EMPTY', '\u65e0'),
                            ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                        ],
                        default='EMPTY',
                        max_length=32,
                        verbose_name='\u5904\u7406\u4eba\u7c7b\u578b',
                    ),
                ),
                (
                    'processors',
                    models.CharField(
                        blank=True, default='', max_length=255, null=True, verbose_name='\u5904\u7406\u4eba\u5217\u8868'
                    ),
                ),
                (
                    'delivers_type',
                    models.CharField(
                        choices=[
                            ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                            ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                            ('OPEN', '\u4e0d\u9650'),
                            ('PERSON', '\u4e2a\u4eba'),
                            ('STARTER', '\u63d0\u5355\u4eba'),
                            ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                            ('EMPTY', '\u65e0'),
                            ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                        ],
                        default='EMPTY',
                        max_length=32,
                        verbose_name='\u8f6c\u5355\u4eba\u7c7b\u578b',
                    ),
                ),
                (
                    'delivers',
                    models.TextField(blank=True, default='', null=True, verbose_name='\u8f6c\u5355\u4eba\u5217\u8868'),
                ),
                ('can_deliver', models.BooleanField(default=False, verbose_name='\u80fd\u5426\u8f6c\u5355')),
                (
                    'assignors_type',
                    models.CharField(
                        choices=[
                            ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                            ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                            ('OPEN', '\u4e0d\u9650'),
                            ('PERSON', '\u4e2a\u4eba'),
                            ('STARTER', '\u63d0\u5355\u4eba'),
                            ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                            ('EMPTY', '\u65e0'),
                            ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                        ],
                        default='EMPTY',
                        max_length=32,
                        verbose_name='\u6d3e\u5355\u4eba\u7c7b\u578b',
                    ),
                ),
                (
                    'assignors',
                    models.TextField(blank=True, default='', null=True, verbose_name='\u6d3e\u5355\u4eba\u5217\u8868'),
                ),
                (
                    'can_terminate',
                    models.BooleanField(default=False, verbose_name='\u80fd\u5426\u5f3a\u5236\u7ec8\u6b62'),
                ),
                (
                    'terminate_message',
                    models.TextField(blank=True, default='', null=True, verbose_name='\u7ec8\u6b62\u539f\u56e0'),
                ),
                ('fields', jsonfield.fields.JSONField(default={}, verbose_name='\u5b57\u6bb5\u5217\u8868')),
                (
                    'api_instance_id',
                    models.IntegerField(blank=True, default=0, null=True, verbose_name='api\u5b9e\u4f8b\u4e3b\u952e'),
                ),
                ('error_message', models.TextField(blank=True, null=True, verbose_name='\u5931\u8d25\u4fe1\u606f')),
                ('contexts', jsonfield.fields.JSONField(default={}, verbose_name='\u72b6\u6001\u4e0a\u4e0b\u6587')),
            ],
            options={
                'ordering': ('-id',),
                'verbose_name': '\u8282\u70b9\u5904\u7406\u72b6\u6001',
                'verbose_name_plural': '\u8282\u70b9\u5904\u7406\u72b6\u6001',
            },
        ),
        migrations.CreateModel(
            name='TicketGlobalVariable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('key', models.CharField(max_length=255, verbose_name='\u53d8\u91cf\u5173\u952e\u5b57')),
                ('name', models.CharField(default='', max_length=64, verbose_name='\u53d8\u91cf\u540d')),
                ('value', jsonfield.fields.JSONField(default={}, verbose_name='\u53d8\u91cf\u503c')),
                ('state_id', models.IntegerField(blank=True, null=True, verbose_name='\u5173\u8054\u8282\u70b9')),
                ('ticket_id', models.IntegerField(blank=True, null=True, verbose_name='\u5173\u8054\u5355\u636e')),
                ('create_at', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
            ],
            options={
                'verbose_name': '\u5355\u636e\u5168\u5c40\u53d8\u91cf',
                'verbose_name_plural': '\u5355\u636e\u5168\u5c40\u53d8\u91cf',
            },
        ),
        migrations.CreateModel(
            name='TicketToTicket',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('from_ticket_id', models.IntegerField(default=0, verbose_name='\u6e90\u5355\u636eID')),
                ('to_ticket_id', models.IntegerField(default=0, verbose_name='\u76ee\u6807\u5355\u636eID')),
                (
                    'related_type',
                    models.CharField(
                        choices=[('DERIVE', '\u8f6c\u5efa\u5355'), ('MASTER_SLAVE', '\u6bcd\u5b50\u5355')],
                        default='DERIVE',
                        max_length=32,
                        verbose_name='\u5355\u636e\u5173\u8054\u7c7b\u578b',
                    ),
                ),
                ('creator', models.CharField(blank=True, max_length=64, null=True, verbose_name='\u521b\u5efa\u4eba')),
                ('create_at', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
            ],
            options={
                'verbose_name': '\u5355\u636e\u95f4\u5173\u8054',
                'verbose_name_plural': '\u5355\u636e\u95f4\u5173\u8054',
            },
        ),
        migrations.RemoveField(model_name='ticket', name='deadline',),
        migrations.RemoveField(model_name='ticket', name='desc',),
        migrations.AddField(
            model_name='ticket',
            name='pipeline_data',
            field=jsonfield.fields.JSONField(default={}, verbose_name='Pipeline\u6d41\u7a0b\u6811\u5143\u6570\u636e'),
        ),
        migrations.AddField(
            model_name='ticketeventlog',
            name='action',
            field=models.CharField(blank=True, max_length=64, verbose_name='\u52a8\u4f5c'),
        ),
        migrations.AddField(
            model_name='ticketeventlog',
            name='detail_message',
            field=models.CharField(blank=True, max_length=255, null=True, verbose_name='\u8be6\u7ec6\u4fe1\u606f'),
        ),
        migrations.AddField(
            model_name='ticketeventlog',
            name='from_state_name',
            field=models.CharField(blank=True, max_length=64, verbose_name='\u4efb\u52a1name'),
        ),
        migrations.AddField(
            model_name='ticketeventlog',
            name='source',
            field=models.CharField(
                choices=[
                    ('WEB', '\u9875\u9762\u64cd\u4f5c'),
                    ('MOBILE', '\u79fb\u52a8\u7aef\u64cd\u4f5c'),
                    ('SYS', '\u7cfb\u7edf\u64cd\u4f5c'),
                    ('AUTOMATIC', '\u81ea\u52a8\u6267\u884c'),
                ],
                default='WEB',
                max_length=32,
                verbose_name='\u65e5\u5fd7\u6765\u6e90',
            ),
        ),
        migrations.AddField(
            model_name='ticketeventlog',
            name='status',
            field=models.IntegerField(default=0, verbose_name='\u8282\u70b9\u5904\u7406\u72b6\u6001'),
        ),
        migrations.AddField(
            model_name='ticketfield',
            name='api_instance_id',
            field=models.IntegerField(blank=True, default=0, null=True, verbose_name='api\u5b9e\u4f8b\u4e3b\u952e'),
        ),
        migrations.AddField(
            model_name='ticketfield',
            name='is_tips',
            field=models.BooleanField(default=False, verbose_name='\u989d\u5916\u63d0\u793a'),
        ),
        migrations.AddField(
            model_name='ticketfield',
            name='kv_relation',
            field=jsonfield.fields.JSONCharField(
                default={}, max_length=64, verbose_name='\u6e90\u6570\u636e\u7684kv\u5173\u7cfb\u914d\u7f6e'
            ),
        ),
        migrations.AddField(
            model_name='ticketfield',
            name='show_conditions',
            field=jsonfield.fields.JSONField(default={}, verbose_name='\u5b57\u6bb5\u7684\u663e\u793a\u6761\u4ef6'),
        ),
        migrations.AddField(
            model_name='ticketfield',
            name='show_type',
            field=models.IntegerField(
                choices=[(1, '\u76f4\u63a5\u663e\u793a'), (0, '\u6839\u636e\u6761\u4ef6\u5224\u65ad')],
                default=1,
                verbose_name='\u663e\u793a\u6761\u4ef6\u7c7b\u578b',
            ),
        ),
        migrations.AddField(
            model_name='ticketfield',
            name='tips',
            field=models.CharField(
                blank=True, default='', max_length=128, null=True, verbose_name='\u5b57\u6bb5\u5c55\u793a\u8bf4\u660e'
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='current_assignor',
            field=models.CharField(
                blank=True, default='', max_length=255, null=True, verbose_name='\u5206\u6d3e\u4eba\u5217\u8868'
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='current_assignor_type',
            field=models.CharField(
                choices=[
                    ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                    ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                    ('OPEN', '\u4e0d\u9650'),
                    ('PERSON', '\u4e2a\u4eba'),
                    ('STARTER', '\u63d0\u5355\u4eba'),
                    ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                    ('EMPTY', '\u65e0'),
                    ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                ],
                default='EMPTY',
                max_length=32,
                verbose_name='\u5206\u6d3e\u4eba\u7c7b\u578b',
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='current_processors',
            field=models.CharField(
                blank=True, default='', max_length=255, null=True, verbose_name='\u5904\u7406\u8005\u5217\u8868'
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='current_processors_type',
            field=models.CharField(
                choices=[
                    ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                    ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                    ('OPEN', '\u4e0d\u9650'),
                    ('PERSON', '\u4e2a\u4eba'),
                    ('STARTER', '\u63d0\u5355\u4eba'),
                    ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                    ('EMPTY', '\u65e0'),
                    ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                ],
                default='EMPTY',
                max_length=32,
                verbose_name='\u5904\u7406\u8005\u7c7b\u578b',
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='current_status',
            field=models.CharField(
                choices=[
                    ('RUNNING', '\u5904\u7406\u4e2d'),
                    ('FINISHED', '\u5df2\u7ed3\u675f'),
                    ('TERMINATED', '\u88ab\u7ec8\u6b62'),
                ],
                default='RUNNING',
                max_length=32,
                verbose_name='\u5355\u636e\u72b6\u6001',
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='supervise_type',
            field=models.CharField(
                choices=[
                    ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                    ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                    ('OPEN', '\u4e0d\u9650'),
                    ('PERSON', '\u4e2a\u4eba'),
                    ('STARTER', '\u63d0\u5355\u4eba'),
                    ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                    ('EMPTY', '\u65e0'),
                    ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                ],
                default='EMPTY',
                max_length=32,
                verbose_name='\u7763\u529e\u4eba\u7c7b\u578b',
            ),
        ),
        migrations.AlterField(
            model_name='ticket',
            name='supervisor',
            field=models.CharField(
                blank=True, default='', max_length=255, null=True, verbose_name='\u7763\u529e\u5217\u8868'
            ),
        ),
        migrations.AlterField(
            model_name='ticketeventlog',
            name='processors',
            field=models.CharField(
                blank=True, default='', max_length=255, null=True, verbose_name='\u5904\u7406\u4eba\u5217\u8868'
            ),
        ),
        migrations.AlterField(
            model_name='ticketeventlog',
            name='processors_type',
            field=models.CharField(
                choices=[
                    ('CMDB', 'CMDB\u4e1a\u52a1\u516c\u7528\u89d2\u8272'),
                    ('GENERAL', '\u901a\u7528\u89d2\u8272\u8868'),
                    ('OPEN', '\u4e0d\u9650'),
                    ('PERSON', '\u4e2a\u4eba'),
                    ('STARTER', '\u63d0\u5355\u4eba'),
                    ('BY_ASSIGNOR', '\u6d3e\u5355\u4eba\u6307\u5b9a'),
                    ('EMPTY', '\u65e0'),
                    ('ORGANIZATION', '\u7ec4\u7ec7\u67b6\u6784'),
                ],
                default='OPEN',
                max_length=32,
                verbose_name='\u5904\u7406\u4eba\u7c7b\u578b',
            ),
        ),
        migrations.AlterField(
            model_name='ticketeventlog',
            name='to_state_id',
            field=models.IntegerField(blank=True, null=True, verbose_name='\u4e0b\u4e00\u4e2a\u72b6\u6001ID'),
        ),
        migrations.AlterField(
            model_name='ticketeventlog',
            name='transition_id',
            field=models.IntegerField(blank=True, null=True, verbose_name='\u6d41\u8f6cID'),
        ),
        migrations.AlterField(
            model_name='ticketeventlog',
            name='type',
            field=models.CharField(
                choices=[
                    ('TRANSITION', '\u901a\u8fc7'),
                    ('CLAIM', '\u8ba4\u9886\u5de5\u5355'),
                    ('DISTRIBUTE', '\u5206\u6d3e\u5de5\u5355'),
                    ('TERMINATE', '\u7ec8\u6b62'),
                    ('SUSPEND', '\u6302\u8d77'),
                    ('UNSUSPEND', '\u6062\u590d'),
                    ('DELIVER', '\u8f6c\u5355'),
                    ('WITHDRAW', '\u64a4\u5355'),
                    ('FOLLOW', '\u5173\u6ce8'),
                    ('FINISHED', '\u5df2\u5b8c\u6210'),
                    ('REPULSE', '\u6253\u56de'),
                    ('AUTOMATIC', '\u81ea\u52a8\u6267\u884c'),
                ],
                default='TRANSITION',
                max_length=32,
                verbose_name='\u6d41\u8f6c\u4e8b\u4ef6\u7c7b\u578b',
            ),
        ),
        migrations.AlterField(
            model_name='ticketfield',
            name='desc',
            field=models.CharField(
                blank=True, default='', max_length=128, null=True, verbose_name='\u5b57\u6bb5\u586b\u5199\u8bf4\u660e'
            ),
        ),
        migrations.AlterField(
            model_name='ticketfield',
            name='related_fields',
            field=jsonfield.fields.JSONField(
                blank=True, default={}, null=True, verbose_name='\u7ea7\u8054\u5b57\u6bb5'
            ),
        ),
        migrations.AddField(
            model_name='ticket',
            name='node_status',
            field=models.ManyToManyField(help_text='\u8282\u70b9\u72b6\u6001', to='ticket.Status'),
        ),
    ]
